﻿using System.Net.Mail ;
using NC.Data;

namespace NC.ViewModels
{
    public class ReplyPost
    {
        public string PostCreatorEmail { get; set; }
        public string ReplierName { get; set; }
        public string ReplierPhone { get; set; }
        public string ReplierEmail { get; set; }
        public string ReplyMessage { get; set; }

        public MailMessage GetReplyToAPostMessage()
        {
            var emailTemplateService = new EmailTemplateRepository();
            var emailTemplate = emailTemplateService.GetEmailTemplateByName(TemplateName.ReplyToAPost.ToString());
            var mail = new MailMessage(NcConstants.NcEmail, PostCreatorEmail)
            {
                Body = string.Format(emailTemplate.EmailBody, ReplierName, ReplierEmail, ReplyMessage),
                Subject = emailTemplate.Subject,
                IsBodyHtml = true,
                BodyEncoding = System.Text.Encoding.GetEncoding("utf-8")
            };
            return mail;
        }
    }
}